- layout :
-
large_read_area
HAL PSSI Typical use cases for migration ¶
This section provides information about the HAL PSSI Typical use cases for migration.
Note
The processes for transmitting and receiving data using polling or DMA are the same in HAL1 and HAL2, except for the initialization and configuration steps.
In HAL1, the initialization and configuration are done in a single step using the
HAL_PSSI_Init()
function.
In HAL2, the initialization and configuration are split into two steps using the
HAL_PSSI_Init()
and
HAL_PSSI_SetConfig()
functions.
HAL PSSI transmit receive in polling mode ¶
|
HAL1 |
HAL2 |
|---|---|
|
|
|
Code snippet ¶
|
HAL1 |
HAL2 |
|---|---|
PSSI_HandleTypeDef PSSI_Handle;
uint8_t tData8[] = {0x12, 0x9A};
uint8_t rData8[2];
PSSI_Handle.Instance = PSSI;
PSSI_Handle.Init.BusWidth = HAL_PSSI_8LINES;
PSSI_Handle.Init.DataWidth = HAL_PSSI_8BITS;
PSSI_Handle.Init.ControlSignal = HAL_PSSI_DE_ENABLE;
PSSI_Handle.Init.ClockPolarity = HAL_PSSI_FALLING_EDGE;
PSSI_Handle.Init.ReadyPolarity = HAL_PSSI_RDYPOL_ACTIVE_LOW;
PSSI_Handle.Init.DataEnablePolarity = HAL_PSSI_DEPOL_ACTIVE_LOW;
HAL_PSSI_Init(&PSSI_Handle);
/* Ensure that all required peripherals
(GPIO,NVIC interrupts, etc..) are configured properly
*/
HAL_PSSI_Transmit(&PSSI_Handle, tData8, 2U, 0xFF);
HAL_PSSI_Receive(&PSSI_Handle, rData8, 2U, 0xFF);
|
hal_pssi_handle_t hpssi;
hal_pssi_config_t p_config;
uint8_t tData8[] = {0x12, 0x9A};
uint8_t rData8[2];
HAL_PSSI_Init(&hpssi, HAL_PSSI);
p_config.bus_width_line = HAL_PSSI_BUS_WIDTH_8LINE;
p_config.data_width_bit = HAL_PSSI_DATA_WIDTH_8BIT;
p_config.control_signal = HAL_PSSI_CONTROL_SIGNAL_DE_ENABLE;
p_config.clock_polarity = HAL_PSSI_CLOCK_POLARITY_RX_RISING_TX_FALLING_EDGE;
p_config.ready_polarity = HAL_PSSI_READY_POLARITY_LOW;
p_config.data_enable_polarity = HAL_PSSI_DATA_ENABLE_POLARITY_LOW;
HAL_PSSI_SetConfig(&hpssi, &p_config);
/* Ensure that all required peripherals
(GPIO,NVIC interrupts, etc..) are configured properly
*/
HAL_PSSI_Transmit(&hpssi, (void *)tData8, 2U, 0xFF);
HAL_PSSI_Receive(&hpssi, (void *)rData8, 2U, 0xFF);
|
HAL PSSI transmit receive with DMA mode ¶
Note
In HAL1, the PSSI limit transmit/receive size is 64K bytes when using DMA mode. In HAL2, this limit is up to 4G bytes.
Sequence diagram ¶
Code snippet ¶
|
HAL1 |
HAL2 |
|---|---|
PSSI_HandleTypeDef PSSI_Handle;
DMA_HandleTypeDef hdma_handler_tx;
DMA_HandleTypeDef hdma_handler_rx;
uint8_t tData8[] = {0x12, 0x9A};
uint8_t rData8[2];
PSSI_Handle.Instance = PSSI;
PSSI_Handle.Init.BusWidth = HAL_PSSI_8LINES;
PSSI_Handle.Init.DataWidth = HAL_PSSI_8BITS;
PSSI_Handle.Init.ControlSignal = HAL_PSSI_DE_ENABLE;
PSSI_Handle.Init.ClockPolarity = HAL_PSSI_FALLING_EDGE;
PSSI_Handle.Init.ReadyPolarity = HAL_PSSI_RDYPOL_ACTIVE_LOW;
PSSI_Handle.Init.DataEnablePolarity = HAL_PSSI_DEPOL_ACTIVE_LOW;
HAL_PSSI_Init(&PSSI_Handle);
/* Ensure that all required peripherals
(DMA, GPIO,NVIC interrupts, etc..) are configured properly
*/
__HAL_LinkDMA(hpssi, hdmatx, hdma_handler_tx);
__HAL_LinkDMA(hpssi, hdmarx, hdma_handler_rx);
HAL_PSSI_Transmit_DMA(&PSSI_Handle, tData8, 2U);
HAL_PSSI_Receive_DMA(&PSSI_Handle, rData8, 2U);
|
hal_pssi_handle_t hpssi;
hal_pssi_config_t p_config;
hal_dma_handle_t hdma_handler_tx;
hal_dma_handle_t hdma_handler_rx;
const uint8_t tData8[] = {0x12, 0x9A};
uint8_t rData8[2];
HAL_PSSI_Init(&hpssi, HAL_PSSI);
p_config.bus_width_line = HAL_PSSI_BUS_WIDTH_8LINE;
p_config.data_width_bit = HAL_PSSI_DATA_WIDTH_8BIT;
p_config.control_signal = HAL_PSSI_CONTROL_SIGNAL_DE_ENABLE;
p_config.clock_polarity = HAL_PSSI_CLOCK_POLARITY_RX_RISING_TX_FALLING_EDGE;
p_config.ready_polarity = HAL_PSSI_READY_POLARITY_LOW;
p_config.data_enable_polarity = HAL_PSSI_DATA_ENABLE_POLARITY_LOW;
HAL_PSSI_SetConfig(&hpssi, &p_config);
/* Ensure that all required peripherals
(DMA, GPIO,NVIC interrupts, etc..) are configured properly
*/
HAL_PSSI_SetTxDMA(&hpssi, &hdma_handler_tx);
HAL_PSSI_SetRxDMA(&hpssi, &hdma_handler_rx);
HAL_PSSI_Transmit_DMA(&hpssi, (void *)t_data, 2U, 0xFF);
HAL_PSSI_Receive_DMA(&hpssi, (void *)r_data, 2U, 0xFF);
|